From 68461397a35e02bd380a8ea14ab4da13613a38c1 Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Mon, 31 Aug 2009 10:10:17 +0100 Subject: [PATCH] x86/numa: fix c/s 20120 (Fix SRAT check for discontig memory) That change converted the (wrong) assumption of contiguous nodes' memory to a similarly wrong one of assuming discontiguous memory (i.e. each node having separate E820 table entries). The code ought to be able to deal with both, though, and I hope this change makes it so. Signed-off-by: Jan Beulich Acked-by: Alex Williamson --- xen/arch/x86/srat.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/xen/arch/x86/srat.c b/xen/arch/x86/srat.c index b49654b78e..1a6d2a10fb 100644 --- a/xen/arch/x86/srat.c +++ b/xen/arch/x86/srat.c @@ -249,15 +249,23 @@ static int nodes_cover_memory(void) start = e820.map[i].addr; end = e820.map[i].addr + e820.map[i].size - 1; - found = 0; - for_each_node_mask(j, nodes_parsed) { - if (start >= nodes[j].start && end <= nodes[j].end) { - found = 1; - break; - } - } - - if (!found) { + do { + found = 0; + for_each_node_mask(j, nodes_parsed) + if (start < nodes[j].end + && end > nodes[j].start) { + if (start >= nodes[j].start) { + start = nodes[j].end; + found = 1; + } + if (end <= nodes[j].end) { + end = nodes[j].start; + found = 1; + } + } + } while (found && start < end); + + if (start < end) { printk(KERN_ERR "SRAT: No PXM for e820 range: " "%016Lx - %016Lx\n", start, end); return 0; -- 2.30.2